//
//  ViewController.m
//  04-homeWork-Player
//
//  Created by 402030900@qq.com on 16/7/19.
//  Copyright © 2016年 402030900@qq.com. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    // 背景图片
    UIImageView * backImageView = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    [self.view addSubview:backImageView];
    backImageView.image = [UIImage imageNamed:@"player_albumblur_default"];
    // 音乐唱片背景图片
    UIImageView * radioCircleImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 340, 340)];
    radioCircleImageView.center = CGPointMake(375 / 2, 667 / 2 - 25);
    [self.view addSubview:radioCircleImageView];
    radioCircleImageView.image = [UIImage imageNamed:@"player_albumcover_default"];
    //左上角close
    UIButton * close = [UIButton buttonWithType:(UIButtonTypeSystem)];
    close.frame = CGRectMake(10,15, 50, 50);
    close.backgroundColor =[UIColor clearColor];
    [self.view addSubview:close];
    [close setBackgroundImage:[UIImage imageNamed:@"player_btn_close_normal"] forState:(UIControlStateNormal)];
    //右上角more
    UIButton * more = [UIButton buttonWithType:(UIButtonTypeSystem)];
    more.frame = CGRectMake(375 - 60,15, 50, 50);
    more.backgroundColor = [UIColor clearColor];
    [self.view addSubview:more];
    [more setBackgroundImage:[UIImage imageNamed:@"player_btn_more_normal"] forState:(UIControlStateNormal)];
    // Music名字Label
    UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 300, 100)];
    label.center = CGPointMake(375 / 2,70 - 15);
    label.backgroundColor = [UIColor clearColor];
    [self.view addSubview:label];
    label.text = @"歌曲名";
    label.font = [UIFont systemFontOfSize:40];
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor whiteColor];
    // 歌手名
    //singerLeft--
    UIImageView * singerLineLeft = [[UIImageView alloc] initWithFrame:CGRectMake(100, 120 - 15, 30, 1)];
    singerLineLeft.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:singerLineLeft];
    //singerRight--
    UIImageView * singerLineRight = [[UIImageView alloc] initWithFrame:CGRectMake(375 - 100 - 30, 120 - 15, 30, 1)];
    singerLineRight.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:singerLineRight];
    //singerName
    UILabel * singerNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(130, 100 - 15, 375 - 260, 40)];
    singerNameLabel.backgroundColor = [UIColor clearColor];
    [self.view addSubview:singerNameLabel];
    singerNameLabel.text = @"歌手名";
    singerNameLabel.textAlignment = NSTextAlignmentCenter;
    singerNameLabel.textColor = [UIColor whiteColor];
    //开通免流量
    UIImageView * freeFlow = [[UIImageView alloc] initWithFrame:CGRectMake(40, 140 - 15, 100, 30)];
    freeFlow.backgroundColor = [UIColor clearColor];
    [self.view addSubview:freeFlow];
    freeFlow.image = [UIImage imageNamed:@"player_btn_chinaunicom_normal"];
    //SQ
    UIImageView * sq = [[UIImageView alloc] initWithFrame:CGRectMake(145, 140 - 15, 60, 30)];
    sq.backgroundColor = [UIColor clearColor];
    [self.view addSubview:sq];
    sq.image = [UIImage imageNamed:@"player_btn_sq_sel_normal"];
    //MV
    UIImageView * mv = [[UIImageView alloc] initWithFrame:CGRectMake(210, 140 - 15, 60, 30)];
    mv.backgroundColor = [UIColor clearColor];
    [self.view addSubview:mv];
    mv.image = [UIImage imageNamed:@"player_btn_mv_normal"];
    //dts
    UIImageView * dts = [[UIImageView alloc] initWithFrame:CGRectMake(275, 140 - 15, 60, 30)];
    dts.backgroundColor = [UIColor clearColor];
    [self.view addSubview:dts];
    dts.image = [UIImage imageNamed:@"player_btn_dts_off"];
    //歌词
    UILabel * lyric = [[UILabel alloc] initWithFrame:CGRectMake(20, 480 - 15, 375 - 40, 25)];
    lyric.backgroundColor = [UIColor clearColor];
    [self.view addSubview:lyric];
    lyric.text = @"这是歌词呀  歌词呀  歌词呀";
    lyric.textAlignment = NSTextAlignmentCenter;
    lyric.textColor = [UIColor whiteColor];
    //滚动条
    UIPageControl * pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(0, 0, 0,0)];
    pageControl.center = CGPointMake(375 / 2, 520 - 20);
    [self.view addSubview:pageControl];
    pageControl.numberOfPages = 3;
    //滑动条
    UISlider * process = [[UISlider alloc] initWithFrame:CGRectMake(0, 0, 375 - 100, 0)];
    process.center = CGPointMake(375 / 2, 550 - 25);
    [self.view addSubview:process];
    [process setThumbImage:[UIImage imageNamed:@"player_slider_playback_thumb"] forState:(UIControlStateNormal)];
    [process setMaximumTrackImage:[UIImage imageNamed:@"player_slider_playback_right"] forState:(UIControlStateNormal)];
    [process setMinimumTrackImage:[UIImage imageNamed:@"player_slider_playback_left"] forState:(UIControlStateNormal)];
    process.value = 0.3;
    // 播放按钮
    // pre
    UIButton * frontSong = [UIButton buttonWithType:(UIButtonTypeSystem)];
    frontSong.frame = CGRectMake(70, 560 - 15, 70, 70);
    [self.view addSubview:frontSong];
    frontSong.backgroundColor =[UIColor clearColor];
    [frontSong setBackgroundImage:[UIImage imageNamed:@"player_btn_pre_normal"] forState:(UIControlStateNormal)];
    //playing
    UIButton * playing = [UIButton buttonWithType:(UIButtonTypeSystem)];
    playing.frame = CGRectMake(0, 0, 80, 80);
    playing.center = CGPointMake(375 / 2, 595 - 15);
    [self.view addSubview:playing];
    playing.backgroundColor = [UIColor clearColor];
    [playing setBackgroundImage:[UIImage imageNamed:@"player_btn_play_normal"] forState:(UIControlStateNormal)];
    [playing addTarget:self action:@selector(playing:) forControlEvents:(UIControlEventTouchUpInside)];
    
    //next
    UIButton * nextSong = [UIButton buttonWithType:(UIButtonTypeSystem)];
    nextSong.frame = CGRectMake(375 - 140, 560 - 15, 70, 70);
    nextSong.backgroundColor = [UIColor clearColor];
    [self.view addSubview:nextSong];
    [nextSong setBackgroundImage:[UIImage imageNamed:@"player_btn_next_normal"] forState:(UIControlStateNormal)];
    //airPlay
    UIButton * airPlay = [UIButton buttonWithType:(UIButtonTypeSystem)];
    airPlay.frame = CGRectMake(320, 560 - 15, 40, 40);
    airPlay.backgroundColor =[UIColor clearColor];
    [self.view addSubview:airPlay];
    [airPlay setBackgroundImage:[UIImage imageNamed:@"player_btn_airplay_normal"] forState:(UIControlStateNormal)];
    //BottomButton
    //点赞
    UIButton * bottomHeart = [UIButton buttonWithType:(UIButtonTypeSystem)];
    bottomHeart.frame = CGRectMake(30, 667 - 50, 50, 50);
    bottomHeart.backgroundColor =[UIColor clearColor];
    [self.view addSubview:bottomHeart];
    [bottomHeart setBackgroundImage:[UIImage imageNamed:@"player_btn_favorite_normal"] forState:(UIControlStateNormal)];
    //repeat
    UIButton * bottomRepeat = [UIButton buttonWithType:(UIButtonTypeSystem)];
    bottomRepeat.frame = CGRectMake(100, 667 - 50, 50, 50);
    bottomRepeat.backgroundColor =[UIColor clearColor];
    [self.view addSubview:bottomRepeat];
    [bottomRepeat setBackgroundImage:[UIImage imageNamed:@"player_btn_repeat_normal"] forState:(UIControlStateNormal)];
    //download
    UIButton * bottomDownload = [UIButton buttonWithType:(UIButtonTypeSystem)];
    bottomDownload.frame = CGRectMake(170, 667 - 50, 50, 50);
    bottomDownload.backgroundColor =[UIColor clearColor];
    [self.view addSubview:bottomDownload];
    [bottomDownload setBackgroundImage:[UIImage imageNamed:@"player_btn_download_normal"] forState:(UIControlStateNormal)];
    //share
    UIButton * bottomShare = [UIButton buttonWithType:(UIButtonTypeSystem)];
    bottomShare.frame = CGRectMake(240, 667 - 50, 50, 50);
    bottomShare.backgroundColor =[UIColor clearColor];
    [self.view addSubview:bottomShare];
    [bottomShare setBackgroundImage:[UIImage imageNamed:@"hp_player_btn_share_normal"] forState:(UIControlStateNormal)];
    //playlist
    UIButton * bottomPlayList = [UIButton buttonWithType:(UIButtonTypeSystem)];
    bottomPlayList.frame = CGRectMake(310, 667 - 50, 50, 50);
    bottomPlayList.backgroundColor =[UIColor clearColor];
    [self.view addSubview:bottomPlayList];
    [bottomPlayList setBackgroundImage:[UIImage imageNamed:@"player_btn_playlist_normal"] forState:(UIControlStateNormal)];
    
    // Do any additional setup after loading the view, typically from a nib.
}
-(void)playing:(UIButton *)button {
    [button setBackgroundImage:[UIImage imageNamed:@"player_btn_pause_normal"] forState:(UIControlStateNormal)];
    [button removeTarget:self action:@selector(playing:) forControlEvents:(UIControlEventTouchUpInside)];
    [button addTarget:self action:@selector(pause:) forControlEvents:(UIControlEventTouchUpInside)];
}
-(void)pause:(UIButton *)button {
    [button setBackgroundImage:[UIImage imageNamed:@"player_btn_play_normal"] forState:(UIControlStateNormal)];
    [button removeTarget:self action:@selector(pause:) forControlEvents:(UIControlEventTouchUpInside)];
    [button addTarget:self action:@selector(playing:) forControlEvents:(UIControlEventTouchUpInside)];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
